from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
# 百度比较特殊，需要用WebDriverWait对其进行专门处理
wait=WebDriverWait(driver,10)
wait.until(EC.presence_of_element_located((By.ID, "s_lg_img")))
# 根据name属性获取，可能会得到多个元素，此时使用find_elements  最后这里要加上s
elements = driver.find_elements(By.NAME,"tj_settingicon")
# 多个元素查看
for i in  elements:
    print(i.text)
# 关闭驱动
driver.close()